<?php

class Zend_View_Helper_Videoclips extends Zend_View_Helper_Abstract {

    protected $_keyword;
    protected $_country;
    protected $_language;
    protected $_drinkName;
    protected $_domain;
    /*
     * This helper makes url for drinks videos
     *
     *
     */

    public function videoclips($section = "drinks", $type = "regular", $name = "") {
        $session = new Zend_Session_Namespace('GrandMarnier');
        $this->_language = $session->userLanguage;
        $this->_country = $session->country;
        $this->_drinkName = $this->getName($name);
        $this->_domain = $this->getDomain();
        $returnValue = "";
        if ($type == "regular") {
            $returnValue = $this->regular();
        } elseif ($type == "iPhone") {
            $returnValue = $this->iPhone();
        }
        return $returnValue;
    }

    private function iPhone() {
        $path = $this->_domain."/videoclips/".$this->_language."/".$this->_drinkName."/".$this->_drinkName.".mov";
        return $path;
    }

    private function regular() {
        $path = $this->_domain."/videoclips/".$this->_language."/".$this->_drinkName.".flv";
        return $path;
    }

    private function getDomain() {
        switch (APPLICATION_ENV) {
            case 'production':
                $domain = "";
                break;
            case 'development':
                $domain = "http://en.grand-marnier.com";
                break;
            case 'staging':
                $domain = "http://en.grand-marnier.com";
                break;
        }
        return $domain;
    }

    private function getName($name) {
        $name = str_replace(" ", "_", $name);
        $name = str_replace("é", "e", $name);
        $name = str_replace("®", "", $name);
        $name = str_replace("'", "_", $name);
        return $name;
    }
    // The default representation of the greeting. Let's be nice, by default.
    public function __toString() {
        return "";
    }

}

#echo  $this->translatex('PRODUCT_HISTORY_WQ');
?>